////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    GoldenGloveGuts.h                                            //
//  Developer:   Tommy Riddle                                                 //
//  Create date: 02/17/2006                                                   //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class declaration for the slot gut of the        //
//               Australian Slot machine called Golden Glove.                 //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2006 - Realtime Gaming.  All rights reserved.         //
////////////////////////////////////////////////////////////////////////////////

#if !defined(__GOLDENGLOVEGUTS_H__)
#define __GOLDENGLOVEGUTS_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "slotguts.h"

class GoldenGloveGuts : public SlotGuts
{
public:
	GoldenGloveGuts();

	virtual ~GoldenGloveGuts();

private:
	// Shared enums between client and server
	#include "GoldenGloveCommon.h"

	// Helpful lookup arrays.
	static SpinResult m_aLineWinSpinResults[][6];

	static SpinResult m_aScatterWinSpinResults[6];

	// Inline functions to use with the arrays that also do
	// bounds checking.
	static SpinResult lookupLineWinSpinResult( uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aLineWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	static SpinResult lookupScatterWinSpinResult( uint8 nCount )
	{
		if ( nCount < 6 )
		{
			return m_aScatterWinSpinResults[ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	enum EvalType
	{
		etLeftToRight,
		etRightToLeft,
		etHit,
		etSpecialNearMiss
	};

	// Subgame date accessor functions.
	bool m_bResetSubGameDataOnNextSpin;
	bool getRunnerOnFirstBase();
	void setRunnerOnFirstBase( bool bRunner );
	bool getRunnerOnSecondBase();
	void setRunnerOnSecondBase( bool bRunner );
	bool getRunnerOnThirdBase();
	void setRunnerOnThirdBase( bool bRunner );
	int32 getRunsScored();
	void setRunsScored( int32 nRuns );
	void incrementRunsScored();
	int32 getLastHit();
	void setLastHit( int32 nBases );
	int32 getIRow();
	void setIRow( int32 nRow );
	bool getBatterSubstitutionForI();
	void setBatterSubstitutionForI( bool bSubstitute );

	// Helper functions for classifyStops.
	SpinResult getLineWinResultWithPossibleSubstitution( uint8* stops, uint8 testIcon, bool& bSubstitution ) const;

	// Helper functions for classifyScatters.
	void tryForJackpot( SlotSpin* spin );

	SpinResult getScatterWinResult( SlotSpin* spin, EvalType et, int32& scatterPositions, bool& bSubstitution );
	
	void evaluateScatterWin( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions, bool bSubstitution );

	bool evaluateHomeRunFeatureTrigger( SlotSpin* spin, SpinResult srScatterResult, EvalType et, int32 scatterPositions );

	void evaluateGrandSlamFeatureTrigger( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions );

	void addRunBonusScatter( SlotSpin* spin, int32 scatterPositions );

	void evaluateHit( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions );

public:
	virtual void classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line,
		uint8& rtnresult, uint8& multiplier );

	virtual void classifyScatters( SlotSpin *spin );

    virtual bool8 isValidGuts();

    virtual void getGameModeMultiplierAndNoteId( uint8& nGameModeMultiplier, uint8& nNoteId );

protected:

	// Override of the framework function.
	virtual void preSpinClassifyResults( SlotSpin *spin );

#ifdef ALLOW_FORCE_BONUS_GAMES
	void getBonusGameSpin(uint8* pStops);
#endif

};

#endif // !defined(__GOLDENGLOVEGUTS_H__)
